

<template>
  <view class="home-container">
    <PinCustomBar />
    <scroll-view class="home-content" refresher-enabled @refresherrefresh="onRefresherrefresh"
      :refresher-triggered="isTriggered" :scroll-y="true">
    </scroll-view>
  </view>
  <PinSkuPanel ref="skuPanel" />
</template>

<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app';
import { ref } from 'vue';
import Apis from "@/services/modules/home"

import type { floorsState } from '@/types/home';

onLoad(() => {
  getHomeData()
})

const floorData = ref<floorsState[]>()
const getHomeData = async () => {
  const { data } = await Apis.getHomeDataApi('')
  floorData.value = JSON.parse(data.floors_)
}

/* isTriggered */
const isTriggered = ref(false)
const onRefresherrefresh = async () => {
  isTriggered.value = true
  await getHomeData()
  isTriggered.value = false
}

</script>

<style lang="scss">
page {
  background-color: #f7f7f7;
}

.home-container {
  height: 100vh;
  display: flex;
  flex-direction: column;

  .home-content {
    flex: 1;
  }
}
</style>
